<template>
  <div class="wb_send">
    <weibo-edit ref="edit"></weibo-edit>
    <el-button @click="handleSend" class="btn_send" :loading="loading">发送</el-button>
  </div>
</template>
<script>
  import {mapActions} from 'vuex'
  import weiboEdit from '@/components/common/content/weiboEdit'
  export default {
    components: {weiboEdit},
    data () {
      return {
        loading: false
      }
    },
    methods: {
      ...mapActions('weiboManage', ['sendWeibo']),
      // 发送微博
      async handleSend () {
        this.loading = true
        const res = await this.sendWeibo({
          appid: this.$route.params.appid,
          content: this.$refs.edit.content,
          sourceId: this.$refs.edit.image.id
        })
        this.loading = false
        if (res.data.code === 1) {
          this.$message.success('发送成功')
          this.$refs.edit.content = ''
          this.$refs.edit.image = {}
        }
      }
    }
  }
</script>
<style lang="scss">
  .wb_send{
    &{width:700px}
    .btn_send{float:right;margin-top:-25px;}
  }
</style>
